#include "uf.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
        if (argc < 2)
        {
                fprintf(stderr, "Usage:%s <num>\n", argv[0]);
                exit(EXIT_FAILURE);
        }
        int *arr;
        int x, n = atoi(argv[1]);
        int root1, root2, ret;

        arr = Init(n);

        // Find(arr, x);
        Union(arr, Find(arr, 10), Find(arr, 4)); // K-->E
        Union(arr, Find(arr, 11), Find(arr, 4)); // L-->E
        Union(arr, Find(arr, 4), Find(arr, 1));  // E-->B
        Union(arr, Find(arr, 1), Find(arr, 5));  // F-->B
        Union(arr, Find(arr, 1), Find(arr, 0));  // A-->B
        Union(arr, Find(arr, 2), Find(arr, 6));  // G-->C
        Union(arr, Find(arr, 7), Find(arr, 12)); // H-->M
        Union(arr, Find(arr, 7), Find(arr, 3));  // H-->D
        Union(arr, Find(arr, 8), Find(arr, 3));  // I-->D
        Union(arr, Find(arr, 9), Find(arr, 3));  // J-->D

        for (int i = 0; i < n; i++)
                printf("%d ", arr[i]);
        printf("\n");

        printf("%d\n", Find_op(arr, 11));

        for (int i = 0; i < n; i++)
                printf("%d ", arr[i]);
        printf("\n");

        exit(EXIT_SUCCESS);
}
